//
//  Response.m
//  PigMarket
//
//  Created by Felix on 2019/4/11.
//  Copyright © 2019 felix.pigmarket.oc. All rights reserved.
//

#import "Response.h"

@implementation Response

- (instancetype)initWithCode: (NSInteger) code {
    
    self = [super init];
    if (self) {
        self.code = code;
    }
    return self;
}

- (instancetype)initWithCode: (NSInteger) code msg:(NSString *)msg {
    
    self = [super init];
    if (self) {
        self.code = code;
        self.msg = msg;
    }
    return self;
    
}

+ (instancetype)responseWithCode: (NSInteger) code msg:(NSString *)msg {
    return [[Response alloc] initWithCode:code msg:msg];
}

-(NSString *)description {
    return [self yy_modelDescription];
}

- (NSString *)msg {
    if (!_msg || [_msg isKindOfClass:[NSNull class]]) {
        return @"";
    }
    return _msg;
}

- (NSString *)desc {
    if (!_desc|| [_desc isKindOfClass:[NSNull class]]) {
        return @"";
    }
    return _desc;
}

@end
